home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-12-08 | 4.1 KB | 126 lines | [TEXT/GEOL] |
- Item 1252069 7-Dec-89 02:50
-
- From: D5295 Reseach SW Design, D Goldman,PRT
-
- To: MACAPP.TECH$ MacApp Technical
-
- Sub: TTEView vs Interface Guides..
-
- --> Usual caveats and abject apologies from brand-new MacApp'er <--
-
- Since last week I've been subclassing TTEView to implement the Human Interface
- Guidelines (shift-arrow, command-arrow, option-arrow, shift-etc-arrow,
- intelligent definition of "word", intelligent cut & paste, etc, etc). I'm not
- completely done yet, but I do have a few observations:
-
- 1) Controversy starter: Shouldn't all of this already be handled by TTEView???
-
- 2) Shouldn't TTEView.Fields (and TTE*Command.Fields) be {IFC qDebug}'ed?
-
- 3) A bug seems to arise with styled TTEViews, which I think is coming from
- TextEdit. Specifically, if the insertion point is located somewhere within the
- first line of the text, then an up-arrow is supposed to move the insertion
- point to the beginning of the line. It (at least on my SE/30, 6.0.3) doesn't.
- Once you notice this, it's not hard to put in a little work-around in
- DoKeyCommand.
-
- 4) AutoScrollTEView incorrectly assumes that the TTEView is a direct subview of
- its scroller. I've got a bunch of TTEViews inside a TDialogView inside a
- TScroller (which is itself inside a TControl inside another TDialogView inside
- a TWindow). (Trust me.) Anyway, if you drag the mouse from such a TTEView out
- beyond the window, the view scrolls and scrolls until (a) the TTEView is out of
- sight, and then (b) AssumeFocus fails when AutoScrollTEView calls QDToViewPt.
-
- Here's my fix. Since I've only been programming MacApp (or Mac!) for a couple
- of weeks, there are probably things I've done wrong; but it seems to work now:
-
-
- FUNCTION AutoscrollTEView: BOOLEAN;
-
- VAR
- msePt: Point;
- viewPt: VPoint;
- visRect:Rect;
- delta: VPoint;
- vhs:VHSelect;
- lead: INTEGER;
- trail: INTEGER;
- itsDown:BOOLEAN;
- scroller: TScroller;
- locInScroller: VPoint; {added by DWG, 12/6/89}
- aView: TView; {ditto}
-
- BEGIN
- GetMouse(msePt);
- itsDown := StillDown;
- IF itsDown & (pCurrTEView <> NIL) THEN
- BEGIN
- scroller := pCurrTEView.GetScroller(false);
- IF scroller <> NIL THEN
- IF (scroller.fScrollBars[h] <> NIL) | (scroller.fScrollBars[v] <> NIL) THEN
- BEGIN
- pCurrTEView.QDToViewPt(msePt, viewPt);
- { pCurrTEView.GetVisibleRect(visRect);}
-
- {added by DWG, 12/6/89:} {-----------}
-
- aView := pCurrTEView;
- locInScroller := pCurrTEView.fLocation;
- while aView.fSuperView <> scroller do
- BEGIN
- aView.LocalToSuper(viewPt);
- aView := aView.fSuperView;
- aView.LocalToSuper(locInScroller);
- END;
- if (aView <> pCurrTEView) & aView.Focus then;
- aView.GetVisibleRect(visRect);
-
- {-----------}
-
- scroller.AutoScroll(viewPt, delta);
-
- FOR vhs := v TO h DO
- BEGIN
- { lead := pCurrTEView.fLocation.vh[vhs] - visRect.topLeft.vh[vhs];}
- lead := locInScroller.vh[vhs] - visRect.topLeft.vh[vhs];
- { trail := pCurrTEView.fLocation.vh[vhs] + pCurrTEView.fSize.vh[vhs] -}
- trail := locInScroller.vh[vhs] + pCurrTEView.fSize.vh[vhs] -
- visRect.botRight.vh[vhs];
-
- IF delta.vh[vhs] < 0 THEN
- delta.vh[vhs] := Min(MAX(delta.vh[vhs], lead), 0)
- ELSE
- delta.vh[vhs] := MAX(Min(delta.vh[vhs], trail), 0);
- END;
- { The intent of the above is not to do autoscrolling that would scroll
- beyond the subview boundary in any direction }
-
- IF (delta.v <> 0) | (delta.h <> 0) THEN
- BEGIN
- scroller.ScrollBy(delta.h, delta.v, TRUE);
- pAutoScrolled := TRUE;
-
- { includes a frame Update, which could change lots of things, thus
- requiring us, tiresomely, to take some or all of the following
- restorative precautions: }
-
- IF pCurrTEView.Focus THEN
- pCurrTEView.ClipFurtherTo(pCurrTEView.fHTE^^.destRect, 0, 0);
- END
- else{added by DWG, 12/6/89:}
- if (aView <> pCurrTEView) & pCurrTEView.Focus then;
- END;
- END;
- AutoscrollTEView := TRUE;
- END;
-
-
- (Yuck! What happened to the tabs???) (Yes, I'm also new to AppleLink.)
-
-
- Anyhow, I just thought somebody might be interested...
-
-
- -- Dave Goldman
-
-